import pymysql

conn = pymysql.connect(host="localhost", user="root", password="12345678", database="mrsoft", charset="utf8")

cursor = conn.cursor()

cursor.execute('SELECT * FROM books')
result = cursor.fetchall()

cursor.close()
conn.close()

print(result)

for item in result:
  print('图书：《', item[1], '》， 价格：￥',item[3], '元')
    